﻿
// 2023/2/28: 首个版本

#ifndef MJPEG_ENCODER_CPU_H_
#define MJPEG_ENCODER_CPU_H_

#include "spadas.h"
#include "NextCompatibleImage.h"

namespace videonext
{
	using namespace spadas;

	class MJpegEncoderCPU : public Object<class MJpegEncoderCPUVars>
	{
	public:
		MJpegEncoderCPU();
		Bool open(Size2D frameSize, UInt qscale = 6/* 1(best)~31(worst) */);
		void close();
		// input: ImagePointerColor, IplImageColor or AVFrameYUV420P
		Binary encode(CompatibleImage image);
	};

#if defined(VIDEONEXT_WITH_OPENCV)
	// input: with only 1 channel
	Binary encodeJpegImage(CompatibleImage image, Int quality/* 50~100 */);
#endif
}

#endif